FROM php:7.3-fpm

# 统一设置时区
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone


# 更新为国内镜像
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak \
    && echo 'deb http://mirrors.aliyun.com/debian/ buster main non-free contrib' > /etc/apt/sources.list \
    && echo 'deb http://mirrors.aliyun.com/debian-security buster/updates main' >> /etc/apt/sources.list \
    && echo 'deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib' >> /etc/apt/sources.list \
    && echo 'deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib' >> /etc/apt/sources.list \
    && apt-get update

# 扩展按装
# php:7.3-fpm自带扩展
#Core、ctype、curl、date、dom、fileinfo、filter、ftp、hash、iconv、json、libxml、mbstring、mysqlnd、openssl、pcre、PDO、pdo_sqlite
#Phar、posix、readline、Reflection、session、SimpleXML、sodium、SPL、sqlite3、standard、tokenizer、xml、xmlreader、xmlwriter、zlib
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev libxml2-dev libmemcached-dev \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install gd \
    && docker-php-ext-install bcmath \
    && docker-php-ext-install calendar \
    && docker-php-ext-install gettext \
    && docker-php-ext-install sockets \
    && docker-php-ext-install exif \
    && docker-php-ext-install sysvmsg \
    && docker-php-ext-install sysvsem \
    && docker-php-ext-install sysvshm \
    && docker-php-ext-install mysqli \
    && docker-php-ext-install pcntl \
    && docker-php-ext-install pdo_mysql \
    && docker-php-ext-install opcache \
    && docker-php-ext-install shmop \
    && docker-php-ext-install soap \
    && apt-get install -y libsnmp-dev \
    && apt-get install -y snmp \
    && docker-php-ext-install snmp \
    && apt-get install -y libgmp-dev \
    && docker-php-ext-install gmp \
    && apt-get install -y libc-client-dev libkrb5-dev \
    && docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
    && docker-php-ext-install imap \
    && docker-php-ext-install intl \
    && apt-get install -y libldb-dev libldap2-dev \
    && docker-php-ext-install ldap \
    && apt-get install -y libzip-dev \
    && docker-php-ext-install zip \
    && apt-get install -y libbz2-dev \
    && docker-php-ext-install bz2 \
    && apt-get install -y libxslt-dev \
    && docker-php-ext-install xsl \
    && docker-php-ext-install xmlrpc \
    && apt-get install -y libmcrypt-dev \
    && pecl install mcrypt \
    && docker-php-ext-enable mcrypt


# 安装redis扩展
COPY ./extension/redis-5.3.1.tgz /tmp/redis.tgz
RUN mkdir -p /tmp/redis \
    && tar -xf /tmp/redis.tgz -C /tmp/redis --strip-components=1 \
    && rm /tmp/redis.tgz \
    && docker-php-ext-configure /tmp/redis --enable-redis \
    && docker-php-ext-install /tmp/redis \
    && rm -r /tmp/redis

# 安装memcached扩展
COPY ./extension/memcached-3.1.5.tgz /tmp/memcached.tgz
RUN mkdir -p /tmp/memcached \
    && tar -xf /tmp/memcached.tgz -C /tmp/memcached --strip-components=1 \
    && rm /tmp/memcached.tgz \
    && docker-php-ext-configure /tmp/memcached --enable-memcached \
    && docker-php-ext-install /tmp/memcached \
    && rm -r /tmp/memcached

# 安装composer
RUN curl -sS https://getcomposer.org/installer | php \
  && chmod +x composer.phar \
  && mv composer.phar /usr/local/bin/composer \
  && composer config -g repo.packagist composer https://packagist.phpcomposer.com


LABEL Author="yq"
LABEL Version="2020.6"
LABEL Description="PHP 7.3 开发环境镜像. "

